﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Membership.OpenAuth;
using CarRental.Model;
using CarRental.DataAccessLayer;
using CarRental.Utils;

namespace CarRental.Account {
    public partial class Register : Page {
        protected void Page_Load(object sender, EventArgs e) {

            ddlUserType.DataSource = new CarRental.Helpers.OptionItems.UserTypeLst();
            ddlUserType.DataValueField = "Key";
            ddlUserType.DataTextField = "Title";

            ddlUserType.DataBind();
        }

        protected void btnRegister_Click(object sender, EventArgs e) {
            Wcf _wcf = new Wcf();
            if (this.IsValid) {
                user _user = new user();
                _user.login_name = tbUserName.Text;
                _user.password = tbPassword.Text;
                _user.user_type = ddlUserType.SelectedValue;
                _user.user_name = tbUserName.Text;
                _user.address = tbAddress.Text;
                _user.contact_no = tbContactNo.Text;
                _user.status = "A";
                _user.email = tbEmail.Text;
                _user.remarks = "";

                _wcf.InsertUser(_user);

            }
            SendEmail _sendEmail = new SendEmail();
            //_sendEmail.Sendmail(tbEmail.Text, "Test", "HIHI");

        }
    }
}